<?php
/**
 * @Author:  Hex
 * @Date:    2017-03-10 14:56:00
 * @version  $Id$
 */
class YiyuanSessModel extends BaseModel
{
    //获取sess
    public function getSess($session_key,$nowtime){
        return DB::select('id,expiry,login_state')
            ->from('yiyuan_sess')
            ->where('sesskey','=',$session_key)
            ->where('yiyuan_id','=',$this->yiyuan_id)
            ->where('expiry','>=',$nowtime)
            ->order_by('expiry', 'DESC')
            ->execute()
            ->current();
    }

    public function updateSess($session_id,$expirytime)
    {
        return DB::update('yiyuan_sess')
            ->set(array('expiry'  => $expirytime))
            ->where('id','=',$session_id)
            ->where('yiyuan_id', '=', $this->yiyuan_id)
            ->execute();
    }
}
